var assert = require('assert');
var should = require('should');
var util = require('util');
var _ = require('lodash');
var shopModel = require('../../app/models/shopModel');
var config = require('../config');

suite('测试shopModel', function () {
    var shop_model;
    setup(function (done) {
        shopModel.getByRoleId(config.role_id, function (err, model) {
            assert.equal(err == null, true);
            shop_model = model;
            shop_model.toJSON();
            done();
        });
    });

    suite('getLastRefreshTime', function () {
        test('获取上次刷新时间', function (done) {
            shop_model.getLastRefreshTime();
            shop_model.save();
            done();
        });
    });

    suite('addBuyResourceShopNum', function () {
        test('增加资源商城记录', function (done) {
            //shop_model.addBuyResourceShopNum(2);
            shop_model.save();
            done();
        });
    });

    suite('getBuyResourceShopNum', function () {
        test('增加资源商城记录', function () {
            var last_shop_num = shop_model.getBuyResourceShopNum(1);
            shop_model.addBuyResourceShopNum(1);
            assert.equal(last_shop_num == shop_model.getBuyResourceShopNum(1) - 1, true);
        });
    });
});
